home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / jpl_c.zip / STRSAVE.C < prev    next >
Text File  |  1986-05-18  |  896b  |  29 lines

  1. /* 1.0  07-10-85 */
  2. /************************************************************************
  3.  *            Robert C. Tausworthe                *
  4.  *            Jet Propulsion Laboratory            *
  5.  *            Pasadena, CA 91009        1985        *
  6.  ************************************************************************
  7.  *
  8.  *    This is from Kernighan and Ritchie, page 103.
  9.  *
  10.  *---------------------------------------------------------------------*/
  11.  
  12. #include "defs.h"
  13. #include "stdtyp.h"
  14.  
  15. /************************************************************************/
  16.     STRING
  17. strsave(s)        /* get enough storage for s and put s there,
  18.                return pointer to the string, or NULL if no
  19.                string space                 */
  20. /*----------------------------------------------------------------------*/
  21. STRING s;
  22. {
  23.     STRING p, malloc();
  24.  
  25.     if ((p = malloc(strlen(s) + 1)) ISNT NULL)
  26.         strcpy(p, s);
  27.     return p;
  28. }
  29.